home *** CD-ROM | disk | FTP | other *** search
/ Gamers Delight 2 / Gamers Delight 2.iso / Aminet / game / misc / TownMaze.lha / TownMaze / src.lzh / freespace.c < prev    next >
C/C++ Source or Header  |  1991-08-04  |  980b  |  46 lines

  1. /*
  2. ** freespace.c  Copyright 1991 Kent Paul Dolan,
  3. **              Mountain View, CA, USA 94039-0755
  4. **
  5. ** Written to satisfy an inquiry on USENet's rec.games.programmer newsgroup.
  6. ** May be freely used or modified in any non-commercial work.  Copyrighted
  7. ** only to prevent patenting by someone else.
  8. */
  9.  
  10. #include <stdio.h>
  11. #include "townmaze.h"
  12. #include "townproto.h"
  13.  
  14. #ifdef __STDC__
  15. void freespace()
  16. #else
  17. int freespace()
  18. #endif
  19. {
  20.   int i;
  21.  
  22. #ifdef __STDC__
  23.   for (i = 0; i < mazeheight; i++)
  24.   if (free(cmaze[i]) == -1)
  25.   {
  26.      fprintf(stderr,"error freeing cmaze row; quitting freespace early\n");
  27.      exit(1);
  28.   }
  29.   if (free(cmaze) == -1)
  30.   {
  31.      fprintf(stderr,"error freeing cmaze body; quitting freespace early\n");
  32.      exit(1);
  33.   }
  34.   if (free(statlist) == -1)
  35.   {
  36.      fprintf(stderr,"error freeing statlist; quitting freespace early\n");
  37.      exit(1);
  38.   }
  39. #else
  40.   for (i = 0; i < mazeheight; i++) free(cmaze[i]);
  41.   free(cmaze);
  42.   free(statlist);
  43. #endif
  44.   return;
  45. }
  46.